const path = require('path');

//复制文件的模块
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  entry: './app.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  optimization: {
    minimize: false
  },
  resolve: {
    fallback: {
      'fs': false,
      "path": require.resolve("path-browserify"),
      "url": require.resolve("url/"),
      "util": require.resolve("util/"),
      "stream": require.resolve("stream-browserify"),
      "buffer": require.resolve("buffer/"),
      "crypto": require.resolve("crypto-browserify"),
      "timers": require.resolve("timers-browserify")
    }
  },
  target: 'node',
  stats: {
    errorDetails: true,
  },
  plugins: [
    new CopyWebpackPlugin({
      patterns: [
        { from: 'uploads', to: 'uploads' },
        // 可以添加其他需要复制的文件或文件夹
      ],
    }),
  ],
};

